#ifndef SETTINGWIDGET_H
#define SETTINGWIDGET_H

#include <QWidget>
#include <QVariant>
#include <QSpinBox>

#include "settingwidgetinterface.h"
#include "encodercodec.h"

namespace Ui {
    class SettingWidget;
}

class Mencoder;
class EncoderOption;
class VideoQualitySettingDialog;

class SettingWidget : public SettingWidgetInterface
{
    Q_OBJECT

public:
    explicit SettingWidget(EncoderOption *,Mencoder *, QWidget *parent = 0);
    ~SettingWidget();

    EncoderOption * encoderOption() const { return m_option; }

    void syncSettings();


public slots:
    void setValue(const QString &, const QVariant &);

signals:
    void valueChanged(QString,QVariant);

private:
    void loadSupportedCodecs();
    void setup();
    void setExtraConfigDisplay (bool);


private:
    Ui::SettingWidget *ui;
    Mencoder *m_coder;
    EncoderOption *m_option;
    VideoQualitySettingDialog *m_videoQualitySetting;
    QSpinBox *m_lastSizeInputFocus;

    QWidget *m_lastExtraConfigWidget;

private slots:
    void on_rbCustomQ_clicked(bool checked);
    void on_btnCustom_clicked();
    void on_cbAudioCodecs_currentIndexChanged(int index);
    void on_cbVideoCodec_currentIndexChanged(int index);
    void onSizeInputEditingFinished();
    void reValueSize();
};

#endif // SETTINGWIDGET_H
